package org.budo.dubbo.protocol.http.spring.web;

import java.io.Serializable;

import lombok.Getter;
import lombok.Setter;

/**
 * @author lmw
 */
@Getter
@Setter
public class BudoHandlerMethod implements Serializable {
    private static final long serialVersionUID = -809447585751285309L;

    private String interfaceName;

    private String methodName;

    private Class<?>[] parameterTypes;

    public BudoHandlerMethod() {}

    public BudoHandlerMethod(String interfaceName, String methodName, Class<?>[] parameterTypes) {
        this.interfaceName = interfaceName;
        this.methodName = methodName;
        this.parameterTypes = parameterTypes;
    }

    @Override
    public String toString() {
        String str = this.getInterfaceName() + "." + this.getMethodName() + "(";
        Class<?>[] paramTypes = this.getParameterTypes();
        if (null != paramTypes && paramTypes.length > 0) {
            str += paramTypes[0].getName();

            for (int i = 1; i < paramTypes.length; i++) {
                str += ", " + paramTypes[0].getName();
            }
        }
        return str + ")";
    }
}